﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using MyMES.IServices;
using MyMES.Dto;
using VOL.Entity.DomainModels;
using VOL.Core.Utilities.Response;
using VOL.Entity.DomainModels.Core;
using System.Threading.Tasks;

namespace VOL.WebApi.Controllers.WarehouseManagement
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ShipmentsModelController : ControllerBase
    {
        private readonly IShipmentsModelService _shipmentsModelService;
        private readonly ILogger<ShipmentsModelController> _logger;

        public ShipmentsModelController(IShipmentsModelService shipmentsModelService,ILogger<ShipmentsModelController> logger)
        {
            _shipmentsModelService = shipmentsModelService;
            _logger = logger;
        }

        [HttpPost]
        public Task<PageGridData<ShipmentsModelDTO>> GetShipmentsModel([FromBody]GetShipmentsDTO dto)
        {
            return _shipmentsModelService.GetShipmentsModel(dto);
        }

        [HttpPost]
        public async Task<WebResponseContent> AddShipmentsModel([FromBody] ShipmentsModel shipmentsModel)
        {
            return await _shipmentsModelService.AddShipmentsModel(shipmentsModel);
        }

        [HttpPost]
        public async Task<WebResponseContent> UpdShipmentsModel([FromBody]ShipmentsModel shipmentsModel)
        {
            return await _shipmentsModelService.UpdShipmentsModel(shipmentsModel);
        }

        [HttpPost]
        public async Task<WebResponseContent> RemShipmentsModel(string shipmentsCode)
        {
            return await _shipmentsModelService.RemShipmentsModel(shipmentsCode);
        }

        [HttpGet]
        public async Task<WebResponseContent> FindShipmentsModel(string shipmentsCode)
        {
            return await _shipmentsModelService.FindShipmentsModel(shipmentsCode);
        }
    }
}
